import Controller from '../decorators/controller'
import get from '../decorators/get'
import post from '../decorators/post'
import BaseController from './base'
import UserDao from '../dao/userDao'

@Controller('/index')
export default class extends BaseController {
    @get("/hello")
    index1() {
        // this.ctx.body = "hello world"
        return 'hello 我日你啊'
    }

    @get("/login")
    async login() {
        var params = this.getParams()
        var result = await UserDao.findById(params.id)
        return result
    }

    @post("/add")
    async userAdd() {
        var body = this.getBody()
        var result = await UserDao.add(body)
        return result
    }

}
